www.gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\svm\minballdemo1.m

    % Demo on finding minimal ball around data.

% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Modifications
% 11-Nov-2002, V.Franc

% loads data
data=load('data1');

% compute minimal ball around data (one-class SVM) in 'RBF" space
ker='rbf';
arg=0.5;
[Alpha, R, mi2 ] = minball(data.X,ker, arg);

% compute distance between point x and the center of minimal ball which is
% given by Alpha

x=[0;0];  % for example origin...
[d]=kdist(x,data.X,Alpha,ker,arg)

% plots contours with equal distance from the center of min-ball
figure; axis([-1 1 -1 1]); hold on;
pkdist(data.X,Alpha,ker,arg,struct('background',1));